<%@ page
import="web.Topic"
import="java.util.*"
import="web.Topics"
import="web.Users"
import="web.User"
%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<meta charset="utf-8">

<%
List<Topics> topics=(List<Topics>)request.getAttribute("topics");
User u=(User)request.getAttribute("user");
int nowpage=(Integer)request.getAttribute("nowpage");
int pagesize=(Integer)request.getAttribute("pagesize");

// 登录信息
if(u!=null){ %>
	<p>欢迎您！<%=u.getUname() %></p>
<%}else{ %>
	<p>欢迎您!<a href="login.do">请登录</a></p>
<%} %>



<table>
<%for(Topics topic:topics){ %>
	<tr>
	<td><%=topic.getUser().getUname() %></td>
	<td><a href="post.do?tid=<%=topic.getTid() %>"><%=topic.getTheme() %></a></td>
	<td><%=topic.getCreate_time() %></td>
	</tr>
<%} %>

</table>
<form action="bbs_.do" method="get">
<%if(u!=null){ %>
<p>主题<textarea name="theme"></textarea></p>
<p>内容<textarea name="cont"></textarea></p>
<p><input type="submit"></p>
<%} %>
</form>
<p>
第<%=nowpage %>页
<%for(int i=1;i<=pagesize;i++){ %>
	<a href="bbs.do?p=<%=i %>"><%=i %></a>
<%} %>
共<%=pagesize %>页
</p>




